Leadtools.Dicom.Common

MacroSubsitutionDelegate<T> Delegate

Show in webframe
ExampleExample 





Type of user item being passed to the macro process.
The user data passed to the macro process.
The name of the macro.
The parameters passed to the macro.
Provides a delegate type to be used to process a macro.
Syntax
public delegate string MacroSubsitutionDelegate<T>( 
   T item,
   string name,
   params object[] parameters
)
'Declaration
 
Public Delegate Function MacroSubsitutionDelegate(Of T)( _
   ByVal item As T, _
   ByVal name As String, _
   ByVal ParamArray parameters() As Object _
) As String
'Usage
 
Dim instance As New MacroSubsitutionDelegate(Of T)(AddressOf HandlerMethod)

            

            
generic<typename T>
public delegate String^ MacroSubsitutionDelegate( 
   T^ item,
   String^ name,
   ... array<Object^>^ parameters
)

Parameters

item
The user data passed to the macro process.
name
The name of the macro.
parameters
The parameters passed to the macro.

Type Parameters

T
Type of user item being passed to the macro process.

Return Value

A string that represents the macro.
Example
Copy Code  
Imports Leadtools.Dicom.Common.Anonymization

Public Sub MacroProcessorSample()
   Dim processor As New MacroProcessor(Of Object)()

   '
   ' add two macros to the macro processor
   '
   processor.Macros.Add("current_date", New MacroSubsitutionDelegate(Of Object)(AddressOf CurrentDateMacro))
   processor.Macros.Add("current_time", New MacroSubsitutionDelegate(Of Object)(AddressOf CurrentTimeMacro))

   '
   ' Process a macro string
   '
   Console.WriteLine(processor.Process(processor, "${current_date} ==> ${current_time}"))
End Sub

Private Function CurrentDateMacro(ByVal userData As Object, ByVal name As String, ByVal ParamArray parameters As Object()) As String
   Return DateTime.Now.ToShortDateString()
End Function

Private Function CurrentTimeMacro(ByVal userData As Object, ByVal name As String, ByVal ParamArray parameters As Object()) As String
   Return DateTime.Now.ToShortTimeString()
End Function
Requirements

Target Platforms

See Also

Reference

MacroSubsitutionDelegate<T> Members
Leadtools.Dicom.Common.Anonymization Namespace

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.

Leadtools.Dicom.Common requires a Document or Medical toolkit license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features